package io.dshubs.feign;

import io.dshubs.commons.tools.constant.ServiceConstant;
import io.dshubs.commons.tools.utils.Result;
import io.dshubs.dto.SysTenantDTO;
import io.dshubs.feign.fallback.TenantFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @Author: yu
 * @Date: 2021/08/19/9:28
 */
@FeignClient(name = ServiceConstant.DSHUBS_ADMIN_SERVER, contextId = "TenantFeignClient", fallbackFactory = TenantFeignClientFallbackFactory.class)
public interface TenantFeignClient {

    /**
     * 获取所有租户列表
     *
     * @return
     */
    @GetMapping("/sys/tenant/listAll")
    Result<List<SysTenantDTO>> getTenantList();


    /**
     * 获取租户
     * @param tenantCode tenantCode
     * @return list
     */
    @GetMapping("/sys/tenant/code/{tenantCode}")
    Result<SysTenantDTO> getTenantByCode(@PathVariable("tenantCode") Long tenantCode);
}
